/*

Emily Beaulieu 381
Proposal title: Political Parties and Perceptions of Election Fraud

HYPOTHESES

Stated-Hyp 1: Republican candidates associated with voter suppression (voters turned away from the polls) should motivate concerns about fraud at a higher rate than Democratic candidates.

	Test-Hyp 1: Participants in the Republican party winning + voter suppression scenario condition will report a higher likelihood of fraud than participants in the Democratic party winning + voter supression scenario condtion.

Stated-Hyp 2: Democratic candidates associated with voter fraud (community organizations attempting to register ineligible voters) should motivate concerns about fraud at a higher rate than Republican

	Test-Hyp 2: Participants in the Democratic party winning + voter fraud scenario condition will report a higher likelihood of fraud than participants in the Republican party winning + voter fraud scenario condtion.

Stated-Hyp 3: Individuals presented with a scenario where the candidate is a co-partisan should think fraud is less likely than individuals who do not share partisanship with the candidate in their scenario.

	Test-Hyp 3: Participants in the inparty winning condition will report a lower likelihood of fraud than participants in the outparty winning condtion.

Stated-Hyp 4: Individuals presented with information regarding polarization should think fraud is less likely when they receive a scenario in which the winner is a co-partisan compared to individuals who do not receive information about polarization.

	Test-Hyp 4: Participants in the polarization lead sentence + inparty winning condition will report a lower likelihood of fraud than participants in the no polarization sentence + inparty winning condtion.

Stated-Hyp 5: Individuals presented with information regarding polarization should think fraud is less likely when they receive information about the partisan identity of the winning candidate compared to individuals who receive no information about the partisan identity of the winning candidate.

	Test-Hyp 5: Participants in the polarization lead sentence + winning party known condition will report a lower likelihood of fraud than participants in the polarization lead sentence + winning party unknown condtion.

Stated-Hyp 6: Individuals who think fraud likely are more likely to prioritize voter ID for fraud prevention.

	Test-Hyp 6: The more likely participants perceive fraud to be, the more likely they prioritize voter ID for fraud prevention.

Stated-Hyp 7: Respondents who receive a voter fraud scenario are more likely to prioritize voter ID for fraud prevention.

	Test-Hyp 7: Participants in the voter fraud scenario condition are more likely to prioritize voter ID for fraud prevention than participants in control scenario condtion.

Stated-Hyp 8: Respondents who receive a voter suppression scenario are less likely to prioritize voter ID for fraud prevention.

	Test-Hyp 8: Participants in the voter suppression scenario condition are less likely to prioritize voter ID for fraud prevention than participants in control scenario condtion.

********************************************************************************

NOTES: 
	
One could have included the no candidate condition for the test of stated 
hypothesis 3. 
	
*/

clear all
use "TESS3 144 Beauliu_Client.dta"

********************************************************************************
* RECODING

* Party
	cap drop inparty
	tab XPARTY7, mis
	tab XPARTY7, nolabel
	gen inparty = .
	replace inparty = 1 if XPARTY7 < 4
	replace inparty = 0 if XPARTY7 > 4
	label define inparty_lab 0 "Democrat" 1 "Republican" 
	label values inparty inparty_lab
	tab XPARTY7 inparty, mis

* Polarization Condition (based on table on page 4 in questionnaire doc)
	cap drop polarizationCondition
	tab XTESS144, mis
	tab XTESS144, nolabel
	gen polarizationCondition = 0
	replace polarizationCondition = 1 if XTESS144 <= 12
	label define polarizationCondition_lab 0 "No sentence" 1 "Lead sentence" 
	label values polarizationCondition polarizationCondition_lab  	
	tab XTESS144 polarizationCondition, mis

* Scenario Condition (based on table on page 4 in questionnaire doc)
	cap drop scenarioCondition
	tab XTESS144, mis
	tab XTESS144, nolabel
	gen scenarioCondition = 0
	replace scenarioCondition = 1 if XTESS144 == 1 | XTESS144 == 5 | XTESS144 == 9 | XTESS144 == 13 | XTESS144 == 17 | XTESS144 == 21
	replace scenarioCondition = 2 if XTESS144 == 2 | XTESS144 == 6 | XTESS144 == 10 | XTESS144 == 14 | XTESS144 == 18 | XTESS144 == 22
	replace scenarioCondition = 3 if XTESS144 == 3 | XTESS144 == 7 | XTESS144 == 11 | XTESS144 == 15 | XTESS144 == 19 | XTESS144 == 23
	label define scenarioCondition_lab 0 "None" 1 "E-Voting" 2 "Suppression" 3 "Fraud"
	label values scenarioCondition scenarioCondition_lab  	
	tab XTESS144 scenarioCondition, mis

* Winning Condition (based on table on page 4 in questionnaire doc)
	cap drop winningCondition
	tab XTESS144, mis
	tab XTESS144, nolabel
	gen winningCondition = 0
	replace winningCondition = 1 if XTESS144 <= 4 | (XTESS144 > 12 & XTESS144 <=16)
	replace winningCondition = 2 if (XTESS144 > 4 & XTESS144 <= 8) | (XTESS144 > 16 & XTESS144 <=20)
	label define winningCondition_lab 0 "No party" 1 "Democrat" 2 "Republican"
	label values winningCondition winningCondition_lab
	tab XTESS144 winningCondition, mis

* Relation to Winning Party Condition (based on table on page 4 in questionnaire doc)
	cap drop relationWinningCondition
	tab winningCondition inparty, mis
	tab winningCondition inparty, mis nolabel
	gen relationWinningCondition = .
	replace relationWinningCondition = 0 if winningCondition == 1 & inparty == 1
	replace relationWinningCondition = 0 if winningCondition == 2 & inparty == 0
	replace relationWinningCondition = 1 if winningCondition == 1 & inparty == 0
	replace relationWinningCondition = 1 if winningCondition == 2 & inparty == 1
	label define relationWinningCondition_lab 0 "Outparty" 1 "Inparty"
	label values relationWinningCondition relationWinningCondition_lab
	bysort inparty: tab winningCondition relationWinningCondition, mis

* Winning Party Known Condition (based on table on page 4 in questionnaire doc)
	cap drop winningPartyKnownCondition
	tab winningCondition, mis
	tab winningCondition, nolabel
	gen winningPartyKnownCondition = 0
	replace winningPartyKnownCondition = 1 if winningCondition > 0
	label define winningPartyKnownCondition_lab 0 "Unknown" 1 "Known"
	label values winningPartyKnownCondition winningPartyKnownCondition_lab
	tab winningCondition winningPartyKnownCondition, mis

* DV: Likelihood of Fraud (higher values -> higher likelihood of fraud)
	cap drop dvFraud
	tab Q1, mis
	tab Q1, nolabel
	gen dvFraud = 5 - Q1
	replace dvFraud = . if Q1 == -1
	tab Q1 dvFraud, mis

* DV: Prioritizing Voter ID (higher values -> higher likelihood of fraud)
	cap drop dvVoterID
	tab Q3, mis
	tab Q3, nolabel
	gen dvVoterID = 5 - Q3
	replace dvVoterID = . if Q3 == -1
	tab Q3 dvVoterID, mis

********************************************************************************

* ANALYSIS

* Test-Hyp 1: Participants in the Republican party winning + voter suppression scenario condition will report a higher likelihood of fraud than participants in the Democratic party winning + voter supression scenario condtion.
	reg dvFraud i.winningCondition if winningCondition != 0 & scenarioCondition == 2
	tess 2.winningCondition +, init(Beaulieu381) 
	// no support for H1 (p = .473)

	
* Test-Hyp 2: Participants in the Democratic party winning + voter fraud scenario condition will report a higher likelihood of fraud than participants in the Republican party winning + voter fraud scenario condtion.
	reg dvFraud i.winningCondition if winningCondition != 0 & scenarioCondition == 3
	tess 2.winningCondition +
	// no support for H2 (p = .303)

* Test-Hyp 3: Participants in the inparty winning condition will report a lower likelihood of fraud than participants in the outparty winning condtion.
	reg dvFraud i.relationWinningCondition
	tess 1.relationWinningCondition -
	// support for H3 (p = .000)
	
* Test-Hyp 4: Participants in the polarization lead sentence + inparty winning condition will report a lower likelihood of fraud than participants in the no polarization sentence + inparty winning condtion.
	reg dvFraud i.polarizationCondition if relationWinningCondition == 1
	tess 1.polarizationCondition -	
	// no support for H4 (p = .020_W)

* Test-Hyp 5: Participants in the polarization lead sentence + winning party known condition will report a lower likelihood of fraud than participants in the polarization lead sentence + winning party unknown condtion.
	reg dvFraud i.winningPartyKnownCondition if polarizationCondition == 1
	tess 1.winningPartyKnownCondition -
	// support for H5 (p = .016)

* Test-Hyp 6: The more likely participants perceive fraud to be, the more likely they prioritize voter ID for fraud prevention.
	reg dvVoterID dvFraud
	tess dvFraud +
	// support for H6 (p = .000)

* Test-Hyp 7: Participants in the voter fraud scenario condition are more likely to prioritize voter ID for fraud prevention than participants in control scenario condtion.
	reg dvVoterID i.scenarioCondition if scenarioCondition == 0 | scenarioCondition == 3
	tess 3.scenarioCondition +
	// support for H7 (p = .001)

* Test-Hyp 8: Participants in the voter suppression scenario condition are less likely to prioritize voter ID for fraud prevention than participants in control scenario condtion.
	reg dvVoterID i.scenarioCondition if scenarioCondition == 0 | scenarioCondition == 2
	tess 2.scenarioCondition -
	// no support for H8 (p = .035_W)
